package com.itheima.mapper;

import com.itheima.domain.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {
    @Select("select * from student")
    List<Student> selectAll();

    @Select("select * from student where id = #{id}")
    Student selectById(Integer id);

    @Select("select * from student where name=#{name} or age=#{age}")
    List<Student> selectByNameOrAge(@Param("name") String name, @Param("age") Integer age);

    /*@Select("select * from student where id in #{Collection,list}")
    List<Student> selectByIds(List<Integer> list);*/

    /*@Select("select * from student ")
    List<Student> selectCondition(Student stu);*/

    @Insert("insert into student values(#{id},#{name},#{age})")
    Integer insert(Student stu);

    @Update("update student set name =#{name},age=#{age} where id=#{id}")
    Integer update(Student stu);

    /*@Update()
    Integer updateCondition(Student stu);*/

    @Delete("delete from student where id=#{id}")
    Integer delete(Integer id);
}
